// Time:  O(m + n)
// Space: O(m + n)

#include <sstream>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

class Solution {
public:
    vector<string> uncommonFromSentences(string s1, string s2) {
        unordered_map<string, int> count;
        istringstream iss(s1 + " " + s2);
        string word;
        while (iss >> word) {
            ++count[word];
        }
        vector<string> result;
        for (const auto& [word, frequency] : count) {
            if (frequency == 1) {
                result.emplace_back(word);
            }
        }
        return result;
    }
};
